package com.test.nnooolwdeaer.view_wooden.info_input_wooden;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.test.nnooolwdeaer.R;
import com.test.nnooolwdeaer.bean_wooden.process_wooden.ProcessData_wooden;
import com.test.nnooolwdeaer.util_wooden.StringUtil_wooden;
import com.test.nnooolwdeaer.view_wooden.base_wooden.BaseInfoInputViewManager_wooden;

public class CreditReportViewManager_Niri_wooden extends BaseInfoInputViewManager_wooden {

    private View clickView_wooden;
    private TextView titleTv_wooden;
    private ImageView checkIb_wooden;
    private TextView textTv_wooden;

    private boolean isCheck_wooden = false;

    public CreditReportViewManager_Niri_wooden(View view, ProcessData_wooden data){
        super(view,data,"");
    }

    @Override
    protected void init_wooden(){

        clickView_wooden = mView_wooden.findViewById(R.id.view_credit_report_layout_click);
        titleTv_wooden = mView_wooden.findViewById(R.id.view_credit_report_tv_title);
        checkIb_wooden = mView_wooden.findViewById(R.id.view_credit_report_iv_check);
        textTv_wooden = mView_wooden.findViewById(R.id.view_credit_report_tv_text);

        titleTv_wooden.setText(mData_wooden.getTitle_wooden());
        textTv_wooden.setText(StringUtil_wooden.getSafeString_wooden(mData_wooden.getHint_wooden()));

        clickView_wooden.setOnClickListener(v -> {
            checkIb_wooden.setBackgroundResource(isCheck_wooden ? R.drawable.icon_item_check_false:R.drawable.icon_item_check_true);
            isCheck_wooden = !isCheck_wooden;
        });
    }


    @Override
    public boolean checkInput_wooden() {
        if (!mData_wooden.isMustInput_wooden()) return true;
        return isCheck_wooden;
    }

    @Override
    public String getInput_wooden() {
        return isCheck_wooden ? "YES":"NO";
    }

}
